package xyz.hubery.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import xyz.hubery.model.LoginResult;
import xyz.hubery.service.SysLoginService;

/**
 * 登录接口
 */
@Api(tags = "登录接口")
@RestController
public class LoginController {

    @Autowired
    private SysLoginService loginService;


    @ApiOperation(value = "登录方法")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "username", value = "用户名"),
            @ApiImplicitParam(name = "password", value = "密码")})
    @PostMapping("/login")
    public LoginResult login(@RequestParam(required = true) String username, @RequestParam(required = true) String password) {
        return loginService.login(username,password);
    }

}
